package com.zhijian.medical.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 设备状态枚举类
 *
 * @author HCG
 * @version 1.0
 * @date 2022/9/20
 */
@AllArgsConstructor
@Getter
public enum DeviceStatusEnum {

    REPAIR("检修"),
    RUNNING("运行"),
    STORE("封存"),
    AWAITING("待机");


    /**
     * 名称
     */
    private String alias;

    public static DeviceStatusEnum getByAlias(String alias) {
        if (StringUtils.isBlank(alias)) {
            return null;
        }
        DeviceStatusEnum[] deviceStatusEnums = DeviceStatusEnum.values();
        for (DeviceStatusEnum deviceStatusEnum : deviceStatusEnums) {
            if (deviceStatusEnum.getAlias().equals(alias)) {
                return deviceStatusEnum;
            }
        }
        return null;
    }
}
